package com.example.douyin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.douyin.entity.Favourite;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface FavouriteMapper extends BaseMapper<Favourite>{

    @Select("SELECT * FROM favourite WHERE user_id = #{userId} AND video_id = #{videoId}")
    Favourite findByUserIdAndVideoId(Long userId, Long videoId);

    @Delete("DELETE FROM favourite WHERE user_id = #{userId} AND video_id = #{videoId}")
    int deleteByUserIdAndVideoId(Long userId, Long videoId);
}
